package com.android.scanner.utils;

import com.android.scanner.R;

import android.app.ProgressDialog;
import android.content.Context;

public class LoadingUtil {
	private static ProgressDialog dialog;
	
	public static void show(Context context) {
		if (dialog == null)
			dialog = new ProgressDialog(context);
		dialog.setMessage(context.getResources().getString(R.string.loading));
		dialog.show();
	}

	public static void show(Context context, int stringId) {
		if (dialog == null)
			dialog = new ProgressDialog(context);
		dialog.setMessage(context.getResources().getString(stringId));
		dialog.show();
	}

	public static void show(Context context, String str) {
		if (dialog == null)
			dialog = new ProgressDialog(context);
		dialog.setMessage(str);
		dialog.show();
	}

	public static void hide() {
		if (dialog != null && dialog.isShowing()) {
			dialog.dismiss();
		}
	}
}
